{extend name="common@base/common" /}

{block name="style"}
<link href="__CSS__/main.min.css" rel="stylesheet" type="text/css"/>
{/block}

{block name="body"}
<div class="container">
  <ol class="breadcrumb">
      <li><a href="{:url('index/index')}">演示首页</a></li>
      <li>Chosen</li>
  </ol>
<section class="demo-section">
 <div id="pageContent"> 
   <article>
    <p>Chosen是用来增强单选列表和多选列表的更佳选择。</p>
    <div class="alert alert-danger"> 
     <h4>兼容性问题</h4> 
     <p>在触摸屏及移动设备上无法启用 Chosen。</p> 
    </div>
   </article> 
   <section>
    <header>
     <h3>示例</h3>
    </header>
    <article>
     <h4>单项选择和多项选择</h4>
     <div class="example"> 
      <div class="row"> 
       <div class="col-md-3"> 
        <select data-placeholder="选择一个宠物..." class="chosen-select form-control" tabindex="-1"> <option value=""></option> <option value="cat">小猫</option> <option value="fish">金鱼</option> <option value="dragon">龙</option> <option value="mammoth">猛犸</option> <option value="gollum">咕噜</option> </select> 
       </div> 
       <div class="col-md-3"> 
        <select data-placeholder="选择一些爱吃的水果..." class="chosen-select form-control" tabindex="-1" multiple=""> <option value="strawberries">草莓</option> <option value="apple">苹果</option> <option value="orange">橙子</option> <option value="cherry">樱桃</option> <option value="banana">香蕉</option> <option value="figs">无花果</option> </select> 
       </div> 
      </div> 
     </div>

     <pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;select</span><span class="pln"> </span><span class="atn">data-placeholder</span><span class="pun">=</span><span class="atv">&quot;选择一个宠物...&quot;</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">&quot;chosen-select form-control&quot;</span><span class="pln"> </span><span class="atn">tabindex</span><span class="pun">=</span><span class="atv">&quot;2&quot;</span><span class="tag">&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;&quot;</span><span class="tag">&gt;&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;cat&quot;</span><span class="tag">&gt;</span><span class="pln">小猫</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;fish&quot;</span><span class="tag">&gt;</span><span class="pln">金鱼</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;dragon&quot;</span><span class="tag">&gt;</span><span class="pln">龙</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;mammoth&quot;</span><span class="tag">&gt;</span><span class="pln">猛犸</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;gollum&quot;</span><span class="tag">&gt;</span><span class="pln">咕噜</span><span class="tag">&lt;/option&gt;</span><span class="pln">
</span><span class="tag">&lt;/select&gt;</span></code></pre>
     <pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;select</span><span class="pln"> </span><span class="atn">data-placeholder</span><span class="pun">=</span><span class="atv">&quot;选择一些爱吃的水果...&quot;</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">&quot;chosen-select form-control&quot;</span><span class="pln"> </span><span class="atn">tabindex</span><span class="pun">=</span><span class="atv">&quot;2&quot;</span><span class="pln"> </span><span class="atn">multiple</span><span class="pun">=</span><span class="atv">&quot;&quot;</span><span class="tag">&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;strawberries&quot;</span><span class="tag">&gt;</span><span class="pln">草莓</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;apple&quot;</span><span class="tag">&gt;</span><span class="pln">苹果</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;orange&quot;</span><span class="tag">&gt;</span><span class="pln">橙子</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;cherry&quot;</span><span class="tag">&gt;</span><span class="pln">樱桃</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;banana&quot;</span><span class="tag">&gt;</span><span class="pln">香蕉</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;figs&quot;</span><span class="tag">&gt;</span><span class="pln">无花果</span><span class="tag">&lt;/option&gt;</span><span class="pln">
</span><span class="tag">&lt;/select&gt;</span></code></pre>
     <pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'select.chosen-select'</span><span class="pun">).</span><span class="pln">chosen</span><span class="pun">({</span><span class="pln">
    no_results_text</span><span class="pun">:</span><span class="pln"> </span><span class="str">'没有找到'</span><span class="pun">,</span><span class="pln">    </span><span class="com">// 当检索时没有找到匹配项时显示的提示文本</span><span class="pln">
    disable_search_threshold</span><span class="pun">:</span><span class="pln"> </span><span class="lit">10</span><span class="pun">,</span><span class="pln"> </span><span class="com">// 10 个以下的选择项则不显示检索框</span><span class="pln">
    search_contains</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pln">         </span><span class="com">// 从任意位置开始检索</span><span class="pln">
</span><span class="pun">});</span></code></pre>

     <h4>扩展检索</h4>
     <p>有时我们希望用户检索的更加开心，例如为汉语选项添加拼音检索支持。Chosen提供了扩展字段专门用来检索，只需要为<code>&lt;option&gt;</code>标签增加<code>data-keys=&quot;*&quot;</code>属性。</p>
     <p><code>data-keys</code>属性可以用空格或英文逗号来分隔多个供检索的关键字。</p>
     <div class="example"> 
      <select data-placeholder="使用拼音检索，试试“m”或“xm”" class="chosen-select form-control" tabindex="-1"> <option value=""></option> <option value="cat" data-keys="xiaomao xm 猫科动物">小猫</option> <option value="fish" data-keys="jinyu jy">金鱼</option> <option value="dragon" data-keys="long">龙</option> <option value="mammoth" data-keys="mengma mm">猛犸</option> <option value="gollum" data-keys="gulu gl 神话">咕噜</option> </select> 
     </div>

     <pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;select</span><span class="pln"> </span><span class="atn">data-placeholder</span><span class="pun">=</span><span class="atv">&quot;使用拼音检索，试试“m”或“xm”&quot;</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">&quot;chosen-select form-control&quot;</span><span class="pln"> </span><span class="atn">tabindex</span><span class="pun">=</span><span class="atv">&quot;2&quot;</span><span class="tag">&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;&quot;</span><span class="tag">&gt;&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;cat&quot;</span><span class="pln"> </span><span class="atn">data-keys</span><span class="pun">=</span><span class="atv">&quot;xiaomao xm 猫科动物&quot;</span><span class="tag">&gt;</span><span class="pln">小猫</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;fish&quot;</span><span class="pln"> </span><span class="atn">data-keys</span><span class="pun">=</span><span class="atv">&quot;jinyu jy&quot;</span><span class="tag">&gt;</span><span class="pln">金鱼</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;dragon&quot;</span><span class="pln"> </span><span class="atn">data-keys</span><span class="pun">=</span><span class="atv">&quot;long&quot;</span><span class="tag">&gt;</span><span class="pln">龙</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;mammoth&quot;</span><span class="pln"> </span><span class="atn">data-keys</span><span class="pun">=</span><span class="atv">&quot;mengma mm&quot;</span><span class="tag">&gt;</span><span class="pln">猛犸</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;gollum&quot;</span><span class="pln"> </span><span class="atn">data-keys</span><span class="pun">=</span><span class="atv">&quot;gulu gl 神话&quot;</span><span class="tag">&gt;</span><span class="pln">咕噜</span><span class="tag">&lt;/option&gt;</span><span class="pln">
</span><span class="tag">&lt;/select&gt;</span></code></pre>

     <pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'select.chosen-select'</span><span class="pun">).</span><span class="pln">chosen</span><span class="pun">({</span><span class="pln">
    no_results_text</span><span class="pun">:</span><span class="pln"> </span><span class="str">'没有找到'</span><span class="pun">,</span><span class="pln">    </span><span class="com">// 当检索时没有找到匹配项时显示的提示文本</span><span class="pln">
    disable_search_threshold</span><span class="pun">:</span><span class="pln"> </span><span class="lit">10</span><span class="pun">,</span><span class="pln"> </span><span class="com">// 10 个以下的选择项则不显示检索框</span><span class="pln">
    search_contains</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pln">         </span><span class="com">// 从任意位置开始检索</span><span class="pln">
</span><span class="pun">});</span></code></pre>

     <div class="alert alert-primary-inverse"> 
      <h4>提示</h4> 
      <p>扩展检索本身并不提供拼音检索功能，如果你需要支持使用拼音检索时，需要你自己在chosen初始化之前在<code>data-keys</code>属性中写入拼音字符串。</p> 
     </div>
     <h4>调整弹出菜单宽度</h4>
     <h5>固定宽度</h5>
     <p>通常弹出菜单的宽度与下拉按钮的宽度一致，但仍然可以使用 <code>drop_width</code> 来更改弹出菜单宽度。下面的例子中弹出菜单宽度固定为 <code>200px</code>：</p>
     <div class="example"> 
      <select class="chosen-select form-control" data-drop_width="200px"> <option value=""></option> <option value="cat">小猫</option> <option value="fish">金鱼</option> <option value="dragon">龙</option> <option value="mammoth">猛犸</option> <option value="gollum">咕噜</option> </select>
     </div>

     <pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;select</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">&quot;chosen-select form-control&quot;</span><span class="pln"> </span><span class="atn">data-drop_width</span><span class="pun">=</span><span class="atv">&quot;200px&quot;</span><span class="tag">&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;&quot;</span><span class="tag">&gt;&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;cat&quot;</span><span class="tag">&gt;</span><span class="pln">小猫</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;fish&quot;</span><span class="tag">&gt;</span><span class="pln">金鱼</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;dragon&quot;</span><span class="tag">&gt;</span><span class="pln">龙</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;mammoth&quot;</span><span class="tag">&gt;</span><span class="pln">猛犸</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;gollum&quot;</span><span class="tag">&gt;</span><span class="pln">咕噜</span><span class="tag">&lt;/option&gt;</span><span class="pln">
</span><span class="tag">&lt;/select&gt;</span></code></pre>
     <h5>自动宽度</h5>
     <p>有时需要根据弹出菜单内的条目文字长度自动设置弹出面板宽度，尽量减少弹出菜单条目换行，此时可以使用 <code>drop_max_width</code> 来设置一个最大宽度。下面的例子中弹出菜单宽度最大不超过 <code>300px</code>，在最大值返回内尽量减少换行情况：</p>
     <div class="example"> 
      <div class="row"> 
       <div class="col" style="width: 120px"> 
        <select class="chosen-select form-control" data-max_drop_width="200" style="width: 100px;> <option value=""></option> <option value="cat">小猫</option> <option value="fish">金鱼的尾巴好长好长好长好长好长好长好长好长啊</option> <option value="dragon">龙</option> <option value="mammoth">猛犸</option> <option value="gollum">咕噜</option> </select>
 
       </div> 
      </div> 
     </div>
     <pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">&quot;row&quot;</span><span class="tag">&gt;</span><span class="pln">
  </span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">&quot;col&quot;</span><span class="pln"> </span><span class="atn">style</span><span class="pun">=</span><span class="atv">&quot;</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">120px</span><span class="atv">&quot;</span><span class="tag">&gt;</span><span class="pln">
    </span><span class="tag">&lt;select</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">&quot;chosen-select form-control&quot;</span><span class="pln"> </span><span class="atn">data-max_drop_width</span><span class="pun">=</span><span class="atv">&quot;200&quot;</span><span class="pln"> </span><span class="atn">style</span><span class="pun">=</span><span class="atv">&quot;</span><span class="pln">width</span><span class="pun">:</span><span class="pln"> </span><span class="lit">100px</span><span class="atv">&quot;</span><span class="tag">&gt;</span><span class="pln">
      </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;&quot;</span><span class="tag">&gt;&lt;/option&gt;</span><span class="pln">
      </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;cat&quot;</span><span class="tag">&gt;</span><span class="pln">小猫</span><span class="tag">&lt;/option&gt;</span><span class="pln">
      </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;fish&quot;</span><span class="tag">&gt;</span><span class="pln">金鱼的尾巴好长好长好长好长好长好长好长好长啊</span><span class="tag">&lt;/option&gt;</span><span class="pln">
      </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;dragon&quot;</span><span class="tag">&gt;</span><span class="pln">龙</span><span class="tag">&lt;/option&gt;</span><span class="pln">
      </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;mammoth&quot;</span><span class="tag">&gt;</span><span class="pln">猛犸</span><span class="tag">&lt;/option&gt;</span><span class="pln">
      </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;gollum&quot;</span><span class="tag">&gt;</span><span class="pln">咕噜</span><span class="tag">&lt;/option&gt;</span><span class="pln">
    </span><span class="tag">&lt;/select&gt;</span><span class="pln">
  </span><span class="tag">&lt;/div&gt;</span><span class="pln">
</span><span class="tag">&lt;/div&gt;</span></code></pre>

     <h4>紧凑的单项选择</h4>
     <p>使用 <code>compact_search</code> 选项来应用更加紧凑的单选选择框，搜索框与选择框合并一起显示。</p>
     <div class="example"> 
      <select class="chosen-select form-control" data-compact_search="true"> <option value=""></option> <option value="cat">小猫</option> <option value="fish">金鱼</option> <option value="dragon">龙</option> <option value="mammoth">猛犸</option> <option value="gollum">咕噜</option> </select>
     </div>
     <pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;select</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">&quot;chosen-select form-control&quot;</span><span class="pln"> </span><span class="atn">data-compact_search</span><span class="pun">=</span><span class="atv">&quot;true&quot;</span><span class="tag">&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;&quot;</span><span class="tag">&gt;&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;cat&quot;</span><span class="tag">&gt;</span><span class="pln">小猫</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;fish&quot;</span><span class="tag">&gt;</span><span class="pln">金鱼</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;dragon&quot;</span><span class="tag">&gt;</span><span class="pln">龙</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;mammoth&quot;</span><span class="tag">&gt;</span><span class="pln">猛犸</span><span class="tag">&lt;/option&gt;</span><span class="pln">
  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">&quot;gollum&quot;</span><span class="tag">&gt;</span><span class="pln">咕噜</span><span class="tag">&lt;/option&gt;</span><span class="pln">
</span><span class="tag">&lt;/select&gt;</span></code></pre>
     <pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'select.chosen-select'</span><span class="pun">).</span><span class="pln">chosen</span><span class="pun">({</span><span class="pln">
    compact_search</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">true</span><span class="pln">           </span><span class="com">// 启用紧凑的单项选择</span><span class="pln">
</span><span class="pun">});</span></code></pre>

    </article>
   </section> 
   <section>
    <header>
     <h3>用法</h3>
    </header>
    <article>
     <h4>引入资源</h4>
     <p>Chosen 为独立组件，你需要从本地或 CDN 单独引入 lib 目录下的资源：</p>
     <pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="tag">&lt;link</span><span class="pln"> </span><span class="atn">href</span><span class="pun">=</span><span class="atv">&quot;lib/chosen/chosen.min.css&quot;</span><span class="pln"> </span><span class="atn">rel</span><span class="pun">=</span><span class="atv">&quot;stylesheet&quot;</span><span class="tag">&gt;</span><span class="pln">
</span><span class="tag">&lt;script</span><span class="pln"> </span><span class="atn">src</span><span class="pun">=</span><span class="atv">&quot;lib/chosen/chosen.min.js&quot;</span><span class="tag">&gt;&lt;/script&gt;</span></code></pre>
     <h4>选项</h4>
     <div class="table-responsive">
      <table class="table table-bordered"> 
       <thead> 
        <tr> 
         <th>参数</th> 
         <th style="width: 80px">名称</th> 
         <th style="width: 300px">可选值</th> 
         <th>说明</th> 
        </tr> 
       </thead> 
       <tbody> 
        <tr> 
         <td><code>lang</code></td> 
         <td>界面语言</td> 
         <td> 
          <ul> 
           <li><code>'zh_cn'</code>（默认）</li> 
           <li><code>'zh_tw'</code></li> 
           <li><code>'en'</code></li> 
          </ul> </td> 
         <td>如果不设置此值，会自动优先从 <code>&lt;html&gt;</code> 的 <code>[lang]</code> 属性作为界面语言设置。</td> 
        </tr> 
        <tr> 
         <td><code>allow_single_deselect</code></td> 
         <td>允许取消单选</td> 
         <td> 
          <ul> 
           <li><code>'true'</code>：允许取消</li> 
           <li><code>'false'</code>（默认）：不允许</li> 
          </ul> </td>
         <td>如果允许单选取消，则会在用户选择选项之后，显示一个移除按钮，点击此按钮会移除用户选择的项目。</td> 
        </tr> 
        <tr> 
         <td><code>disable_search</code></td> 
         <td>禁用检索</td> 
         <td> 
          <ul> 
           <li><code>'true'</code>：禁用</li> 
           <li><code>'false'</code>（默认）：不禁用</li> 
          </ul> </td> 
         <td>禁用检索功能，将不再现实搜索框来让用户检索选项。</td> 
        </tr> 
        <tr> 
         <td><code>disable_search_threshold</code></td> 
         <td>自动禁用的最大值</td> 
         <td>数字，默认为<code>0</code></td> 
         <td>当可选选项数目小于或等于此值时，自动禁用检索选项。</td> 
        </tr> 
        <tr> 
         <td><code>inherit_select_classes</code></td> 
         <td>继承 <code>&lt;select&gt;</code> 的 CLASS</td> 
         <td>默认为<code>false</code></td> 
         <td>如果设置为<code>true</code>，chosen 在初始化之后会获取原 <code>&lt;select&gt;</code> 上的CSS CLASS 值并添加在chosen容器 <code>.chosen-container</code>上。</td> 
        </tr> 
        <tr> 
         <td><code>max_selected_options</code></td> 
         <td>最大选择数目</td> 
         <td>数字，默认为<code>Infinity</code></td> 
         <td>仅多选生效；当用户选择的选项数目达到此值时，将会触发<code>chosen:maxselected</code>事件。</td> 
        </tr> 
        <tr> 
         <td><code>no_results_text</code></td> 
         <td>无结果时的文本</td> 
         <td>字符串，默认从语言配置获取</td> 
         <td>当用户检索时没有匹配的结果会显示此文本。</td> 
        </tr> 
        <tr> 
         <td><code>placeholder_text</code></td> 
         <td>空值占位文本</td> 
         <td>字符串，默认为<code>&quot;&quot;</code></td> 
         <td>当用户没有选择选项时显示此文本；此选项也可以通过<code>&lt;select&gt;</code>的<code>data-placeholder</code>属性来指定。</td> 
        </tr> 
        <tr> 
         <td><code>placeholder_text_multiple</code></td> 
         <td>多选空值占位文本</td> 
         <td>字符串，默认为<code>&quot;&quot;</code></td> 
         <td>如果没有设置此选项，则会尝试读取<code>placeholder_text</code>选项的值。</td> 
        </tr> 
        <tr> 
         <td><code>placeholder_text_single</code></td> 
         <td>单选空值占位文本</td> 
         <td>字符串，默认为<code>&quot;&quot;</code></td> 
         <td>如果没有设置此选项，则会尝试读取<code>placeholder_text</code>选项的值。</td> 
        </tr> 
        <tr> 
         <td><code>search_contains</code></td> 
         <td>启用任意位置检索</td> 
         <td>默认为<code>false</code></td> 
         <td>默认情况下，仅仅会从选项或检索关键字的开始进行匹配，例如<code>&quot;he&quot;</code>仅仅能匹配<code>&quot;hello&quot;</code>，不能匹配<code>&quot;ahead&quot;</code>，如果启用此选项，则可以从关键的任意位置进行匹配。</td> 
        </tr> 
        <tr> 
         <td><code>compact_search</code></td> 
         <td>是否启用紧凑的单选选择外观</td> 
         <td>默认为<code>false</code></td> 
         <td>如果设置为 <code>true</code>，则搜索框与选择框合并一起显示。</td> 
        </tr> 
        <tr> 
         <td><code>single_backstroke_delete</code></td> 
         <td>启用退格键删除</td> 
         <td>默认为<code>true</code></td> 
         <td>仅多选生效；启用此选项允许用户在多选时按退格键（Backspace）和删除键（Delete）来删除上一个选择项。</td> 
        </tr> 
        <tr> 
         <td><code>width</code></td> 
         <td>宽度</td> 
         <td>默认为原始<code>&lt;select&gt;</code>的宽度</td> 
         <td>默认chosen的宽度与原始的<code>&lt;select&gt;</code>一致，如果原始的<code>&lt;/select&gt;</code>在chosen初始化之前不可见，可能需要手动指定一个宽度，否则chosen的宽度会为<code>0</code>；如果使用响应式布局，建议宽度设定为<code>'100%'</code>。</td> 
        </tr> 
        <tr> 
         <td><code>display_disabled_options</code></td> 
         <td>显示不可选的选项</td> 
         <td>默认为<code>true</code></td> 
         <td>默认情况下会在选项列表菜单中显示不可选的选项，禁用此选项来隐藏不可选的选项。</td> 
        </tr> 
        <tr> 
         <td><code>display_selected_options</code></td> 
         <td>显示已选择的选项</td> 
         <td>默认为<code>true</code></td> 
         <td>仅多选生效；禁用此选项则在选项列表菜单中隐藏已选择的选项。</td> 
        </tr> 
        <tr> 
         <td><code>drop_direction</code></td> 
         <td>选项列表菜单弹出方向</td> 
         <td> 
          <ul> 
           <li><code>&quot;auto&quot;</code>（默认) 根据弹出时根据弹出菜单高度和所在位置自动决定</li> 
           <li><code>&quot;down&quot;</code></li> 
           <li><code>&quot;up&quot;</code></li> 
          </ul> </td> 
         <td>在自动决定情况下默认向下弹出，如果下方空间不够会自动改为向上弹出，搜索过程中不会改变弹出位置。</td> 
        </tr> 
        <tr> 
         <td><code>drop_width</code></td> 
         <td>选项列表菜单宽度</td> 
         <td>例如 <code>200px</code></td> 
         <td>如果不指定此选项则与选择按钮宽度一致。</td> 
        </tr> 
        <tr> 
         <td><code>max_drop_width</code></td> 
         <td>选项列表菜单最大宽度</td> 
         <td>此选项的值只能是数值，以 <code>px</code> 为单位表示最大宽度。</td> 
         <td>使用此选项后会自动根据选项列表条目上的文字长度来调整选项列表宽度。</td> 
        </tr> 
        <tr> 
         <td><code>highlight_selected</code></td> 
         <td>是否一直高亮选中项</td> 
         <td>默认为 <code>true</code></td> 
         <td></td> 
        </tr> 
        <tr> 
         <td><code>middle_highlight</code></td> 
         <td>高亮的选项居中</td> 
         <td> 
          <ul> 
           <li><code>false</code>（默认) 不改变高亮选项位置</li> 
           <li><code>true</code>，当展开弹出菜单时滚动列表使得高亮的选项在弹出菜单的中间位置</li> 
           <li><code>&quot;always&quot;</code>，当展开弹出菜单时以及切换选择高亮的选项时滚动列表使得高亮的选项在弹出菜单的中间位置</li> 
          </ul> </td> 
         <td></td> 
        </tr> 
       </tbody> 
      </table>
     </div>
     <h5>事件</h5>
     <p>Chosen的事件绑定在原始<code>&lt;select&gt;</code>上，使用jQuery方法来监听事件。目前可以使用以下事件：</p>
     <div class="table-responsive">
      <table class="table table-bordered"> 
       <thead> 
        <tr> 
         <th>事件</th> 
         <th>说明</th> 
        </tr> 
       </thead> 
       <tbody> 
        <tr> 
         <td><code>change</code></td> 
         <td>当选择的值发生改变时发生。</td> 
        </tr> 
        <tr> 
         <td><code>chosen:ready</code></td> 
         <td>当完成初始化之后触发。</td> 
        </tr> 
        <tr> 
         <td><code>chosen:maxselected</code></td> 
         <td>当达到最大选择数目（通过<code>max_selected_options</code>指定）时发生</td> 
        </tr> 
        <tr> 
         <td><code>chosen:showing_dropdown</code></td> 
         <td>当弹出显示选项列表菜单时发生。</td> 
        </tr> 
        <tr> 
         <td><code>chosen:hiding_dropdown</code></td> 
         <td>当隐藏选项列表菜单时发生。</td> 
        </tr> 
        <tr> 
         <td><code>chosen:no_results</code></td> 
         <td>当没有检索到匹配的选项时发生。</td> 
        </tr> 
       </tbody> 
      </table>
     </div>
     <pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'select.chosen-select'</span><span class="pun">).</span><span class="pln">on</span><span class="pun">(</span><span class="str">'change'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">(){</span><span class="pln">
    </span><span class="com">// 用户改变了选择，快快处理</span><span class="pln">
</span><span class="pun">});</span></code></pre>
     <h5>方法</h5>
     <p>可以通过触发事件来调用chosen的方法。</p>
     <pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="com">// 当原始select中的选项发生变化时通知chosen更新选项列表菜单</span><span class="pln">
$</span><span class="pun">(</span><span class="str">'select.chosen-select'</span><span class="pun">).</span><span class="pln">trigger</span><span class="pun">(</span><span class="str">'chosen:updated'</span><span class="pun">);</span></code></pre>
     <p>所有可以通过事件触发的方法有：</p>
     <div class="table-responsive">
      <table class="table table-bordered"> 
       <thead> 
        <tr> 
         <th>触发事件</th> 
         <th>说明</th> 
        </tr> 
       </thead> 
       <tbody> 
        <tr> 
         <td><code>chosen:updated</code></td> 
         <td>通知chosen重新从原始select中更新选项列表菜单。</td> 
        </tr> 
        <tr> 
         <td><code>chosen:activate</code></td> 
         <td>让chosen激活并获取焦点；激活之后的chosen会捕获用户输入并执行操作。</td> 
        </tr> 
        <tr> 
         <td><code>chosen:open</code></td> 
         <td>打开（弹出）选项列表菜单面板。</td> 
        </tr> 
        <tr> 
         <td><code>chosen:close</code></td> 
         <td>隐藏选项列表菜单面板。</td> 
        </tr> 
       </tbody> 
      </table>
     </div>
     <p>详细用法可以参考<a href="http://harvesthq.github.io/chosen/options.html">chosen官方文档</a>。</p>
    </article>
   </section> 
   <script src="__ZUI__/lib/chosen/chosen.min.js"></script> 
   <script src="__ZUI__/lib/chosenicons/zui.chosenicons.min.js"></script> 
   <script>
function onPageLoad() {return false;}

$(function(){
  afterPageLoad();
});
function afterPageLoad() {
    if($.fn.chosen) {
        $('.chosen-select').each(function() {
            $(this).chosen($.extend({
                allow_single_deselect: true,
                search_contains: true,
                width: '100%'
            }, $(this).data()));
        });
    }
    if($.fn.chosenIcons) $('#chosenIcons').chosenIcons();
}
</script>
   <section>
    <header>
     <h3>图标选择插件</h3>
    </header>
    <article>
     <h4>示例</h4>
     <p>为方便选择<a href="#control/icon">漂亮的图标</a>，依赖于Chosen新作了<a href="#control/icon">图标</a>选择插件。</p>
     <div class="example"> 
      <form> 
       <select class="chosen-icons chosen-icons-1703540132" name="chosenIcons" id="chosenIcons" data-value="icon-star" style="display: none;"> <option value="">[没有图标]</option><optgroup label="常用图标"> <option value="icon-heart">heart</option> <option value="icon-user">user</option> <option value="icon-group">group</option> <option value="icon-list-ul">list-ul</option> <option value="icon-th">th</option> <option value="icon-th-large">th-large</option> <option value="icon-star">star</option> <option value="icon-star-empty">star-empty</option> <option value="icon-search">search</option> <option value="icon-envelope">envelope</option> <option value="icon-dashboard">dashboard</option> <option value="icon-sitemap">sitemap</option> <option value="icon-umbrella">umbrella</option> <option value="icon-lightbulb">lightbulb</option> <option value="icon-envelope-alt">envelope-alt</option> <option value="icon-cog">cog</option><option value="icon-ok">ok</option><option value="icon-remove">remove</option><option value="icon-home">home</option><option value="icon-time">time</option><option value="icon-flag">flag</option><option value="icon-flag-alt">flag-alt</option><option value="icon-flag-checkered">flag-checkered</option><option value="icon-qrcode">qrcode</option><option value="icon-tag">tag</option><option value="icon-tags">tags</option><option value="icon-book">book</option><option value="icon-bookmark">bookmark</option><option value="icon-bookmark-empty">bookmark-empty</option><option value="icon-print">print</option><option value="icon-camera">camera</option><option value="icon-picture">picture</option><option value="icon-globe">globe</option><option value="icon-map-marker">map-marker</option><option value="icon-edit">edit</option><option value="icon-edit-sign">edit-sign</option><option value="icon-play">play</option><option value="icon-stop">stop</option><option value="icon-plus-sign">plus-sign</option><option value="icon-minus-sign">minus-sign</option><option value="icon-remove-sign">remove-sign</option><option value="icon-ok-sign">ok-sign</option><option value="icon-check-sign">check-sign</option><option value="icon-question-sign">question-sign</option><option value="icon-info-sign">info-sign</option><option value="icon-exclamation-sign">exclamation-sign</option><option value="icon-plus">plus</option><option value="icon-plus-sign">plus-sign</option><option value="icon-minus">minus</option><option value="icon-minus-sign">minus-sign</option><option value="icon-asterisk">asterisk</option><option value="icon-calendar">calendar</option><option value="icon-calendar-empty">calendar-empty</option><option value="icon-comment">comment</option><option value="icon-comment-alt">comment-alt</option><option value="icon-comments">comments</option><option value="icon-comments-alt">comments-alt</option><option value="icon-folder-close">folder-close</option><option value="icon-folder-open">folder-open</option><option value="icon-folder-close-alt">folder-close-alt</option><option value="icon-folder-open-alt">folder-open-alt</option><option value="icon-thumbs-up">thumbs-up</option><option value="icon-thumbs-down">thumbs-down</option><option value="icon-pushpin">pushpin</option><option value="icon-building">building</option><option value="icon-phone">phone</option><option value="icon-rss">rss</option><option value="icon-rss-sign">rss-sign</option><option value="icon-bullhorn">bullhorn</option><option value="icon-bell">bell</option><option value="icon-bell-alt">bell-alt</option><option value="icon-certificate">certificate</option><option value="icon-wrench">wrench</option><option value="icon-tasks">tasks</option><option value="icon-cloud">cloud</option><option value="icon-beaker">beaker</option><option value="icon-magic">magic</option><option value="icon-smile">smile</option><option value="icon-frown">frown</option><option value="icon-meh">meh</option><option value="icon-code">code</option><option value="icon-location-arrow">location-arrow</option></optgroup><optgroup label="Web 图标"><option value="icon-share">share</option><option value="icon-pencil">pencil</option><option value="icon-trash">trash</option><option value="icon-file-alt">file-alt</option><option value="icon-file">file</option><option value="icon-file-text">file-text</option><option value="icon-download-alt">download-alt</option><option value="icon-upload-alt">upload-alt</option><option value="icon-inbox">inbox</option><option value="icon-repeat">repeat</option><option value="icon-refresh">refresh</option><option value="icon-lock">lock</option><option value="icon-check">check</option><option value="icon-check-empty">check-empty</option><option value="icon-eye-open">eye-open</option><option value="icon-eye-close">eye-close</option><option value="icon-key">key</option><option value="icon-signin">signin</option><option value="icon-signout">signout</option><option value="icon-external-link">external-link</option><option value="icon-external-link-sign">external-link-sign</option><option value="icon-link">link</option><option value="icon-reorder">reorder</option><option value="icon-quote-left">quote-left</option><option value="icon-quote-right">quote-right</option><option value="icon-spinner">spinner</option><option value="icon-reply">reply</option><option value="icon-question">question</option><option value="icon-info">info</option><option value="icon-archive">archive</option><option value="icon-collapse">collapse</option><option value="icon-collapse-top">collapse-top</option></optgroup><optgroup label="编辑器图标"><option value="icon-table">table</option><option value="icon-copy">copy</option><option value="icon-save">save</option><option value="icon-list-ol">list-ol</option><option value="icon-paste">paste</option><option value="icon-keyboard">keyboard</option><option value="icon-paper-clip">paper-clip</option><option value="icon-crop">crop</option><option value="icon-unlink">unlink</option><option value="icon-sort-by-alphabet">sort-by-alphabet</option><option value="icon-sort-by-alphabet-alt">sort-by-alphabet-alt</option><option value="icon-sort-by-attributes">sort-by-attributes</option><option value="icon-sort-by-attributes-alt">sort-by-attributes-alt</option><option value="icon-sort-by-order">sort-by-order</option><option value="icon-sort-by-order-alt">sort-by-order-alt</option></optgroup><optgroup label="箭头总汇"><option value="icon-chevron-left">chevron-left</option><option value="icon-chevron-right">chevron-right</option><option value="icon-chevron-down">chevron-down</option><option value="icon-chevron-up">chevron-up</option><option value="icon-arrow-left">arrow-left</option><option value="icon-arrow-right">arrow-right</option><option value="icon-arrow-down">arrow-down</option><option value="icon-arrow-up">arrow-up</option><option value="icon-hand-right">hand-right</option><option value="icon-hand-left">hand-left</option><option value="icon-hand-up">hand-up</option><option value="icon-hand-down">hand-down</option><option value="icon-circle-arrow-left">circle-arrow-left</option><option value="icon-circle-arrow-right">circle-arrow-right</option><option value="icon-circle-arrow-up">circle-arrow-up</option><option value="icon-circle-arrow-down">circle-arrow-down</option><option value="icon-double-angle-left">double-angle-left</option><option value="icon-double-angle-right">double-angle-right</option><option value="icon-double-angle-down">double-angle-down</option><option value="icon-double-angle-up">double-angle-up</option><option value="icon-angle-left">angle-left</option><option value="icon-angle-right">angle-right</option><option value="icon-angle-down">angle-down</option><option value="icon-angle-up">angle-up</option><option value="icon-long-arrow-left">long-arrow-left</option><option value="icon-long-arrow-right">long-arrow-right</option><option value="icon-long-arrow-down">long-arrow-down</option><option value="icon-long-arrow-up">long-arrow-up</option><option value="icon-caret-left">caret-left</option><option value="icon-caret-right">caret-right</option><option value="icon-caret-down">caret-down</option><option value="icon-caret-up">caret-up</option></optgroup><optgroup label="其他图标"><option value="icon-desktop">desktop</option><option value="icon-laptop">laptop</option><option value="icon-tablet">tablet</option><option value="icon-mobile">mobile</option><option value="icon-building">building</option><option value="icon-firefox">firefox</option><option value="icon-ie">ie</option><option value="icon-opera">opera</option><option value="icon-qq">qq</option><option value="icon-lemon">lemon</option><option value="icon-sign-blank">sign-blank</option><option value="icon-circle">circle</option><option value="icon-circle-blank">circle-blank</option><option value="icon-terminal">terminal</option><option value="icon-html5">html5</option><option value="icon-android">android</option><option value="icon-apple">apple</option><option value="icon-windows">windows</option><option value="icon-weibo">weibo</option><option value="icon-wechat">wechat</option><option value="icon-renren">renren</option><option value="icon-bug">bug</option><option value="icon-moon">moon</option> <option value="icon-sun">sun</option> </optgroup> </select> 

      </form> 
     </div> 
     <pre class="prettyprint prettyprinted" style="">
	<code class="lang-html"><span class="tag">&lt;select</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">&quot;chosen-icons form-control&quot;</span><span class="pln"> </span><span class="atn">name</span><span class="pun">=</span><span class="atv">&quot;chosenIcons&quot;</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">&quot;chosenIcons&quot;</span><span class="pln"> </span><span class="atn">data-value</span><span class="pun">=</span><span class="atv">&quot;icon-star&quot;</span><span class="tag">&gt;&lt;/select&gt;</span></code></pre>
     <pre class="prettyprint prettyprinted" style=""><code class="lang-js"><span class="pln">$</span><span class="pun">(</span><span class="str">'select.chosen-icons'</span><span class="pun">).</span><span class="pln">chosenIcons</span><span class="pun">(</span><span class="pln">options</span><span class="pun">);</span></code></pre>
     <h4>用法</h4>
     <p>图标选择插件独立组件，并且依赖 Chosen 插件，你需要从本地或 CDN 单独引入 lib 目录下的资源：</p>
     <pre class="prettyprint prettyprinted" style=""><code class="lang-html"><span class="com">&lt;!-- 引入 Chosen 相关资源 --&gt;</span><span class="pln">
</span><span class="tag">&lt;link</span><span class="pln"> </span><span class="atn">href</span><span class="pun">=</span><span class="atv">&quot;lib/chosen/chosen.min.css&quot;</span><span class="pln"> </span><span class="atn">rel</span><span class="pun">=</span><span class="atv">&quot;stylesheet&quot;</span><span class="tag">&gt;</span>
<span class="pln">
</span>
<span class="tag">&lt;script</span><span class="pln"> </span><span class="atn">src</span><span class="pun">=</span><span class="atv">&quot;lib/chosen/chosen.min.js&quot;</span>
<span class="tag">&gt;&lt;/script&gt;</span>

<span class="pln"></span>
<span class="com">&lt;!-- 引入图标选择插件相关资源 --&gt;</span>
<span class="pln"></span><span class="tag">&lt;link</span><span class="pln"> </span><span class="atn">href</span><span class="pun">=</span><span class="atv">&quot;lib/chosenicons/zui.chosenicons.min.css&quot;</span><span class="pln"> </span><span class="atn">rel</span><span class="pun">=</span><span class="atv">&quot;stylesheet&quot;</span><span class="tag">&gt;</span><span class="pln">
</span><span class="tag">&lt;script</span><span class="pln"> </span><span class="atn">src</span><span class="pun">=</span><span class="atv">&quot;lib/chosenicons/zui.chosenicons.min.js&quot;</span><span class="tag">&gt;&lt;/script&gt;</span></code></pre>
     <p>图标选择插件可以使用chosen的所有选项和方法。</p>
     <p>
      <link href="__ZUI__/lib/chosen/chosen.min.css" rel="stylesheet" /></p>
     <link href="__ZUI__/lib/chosenicons/zui.chosenicons.min.css" rel="stylesheet" />
    </article>
   </section>
  </div>
</section>
{/block}